package com.yichen.bean.processor;

import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.Ordered;
import org.springframework.core.PriorityOrdered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Classname OrderBeanPostProcessor
 * @Description
 * @Author caozhenhao001
 * @Date 2024/4/1
 * @Version
 */
@Component
public class OrderBeanPostProcessor implements BeanPostProcessor, Ordered, MergedBeanDefinitionPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("OrderBeanPostProcessor: " + beanName);
        return bean;
    }

    @Override
    public int getOrder() {
        return 2;
    }

    @Override
    public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {

    }
}
